package com.mcc;

import com.mcc.collect.opc.bootstrap.OpcUAClientRunner;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.Banner;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.scheduling.annotation.EnableAsync;

import java.util.Date;

/**
 * 启动程序
 *
 * @author gxy
 */
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
//@EnableScheduling
@EnableAsync
public class MccOpcApplication implements CommandLineRunner {
    public static void main(String[] args) {
        Date startDt = new Date();
        // System.setProperty("spring.devtools.restart.enabled", "false");
        SpringApplication springApplication = new SpringApplication(MccOpcApplication.class);
        springApplication.setBannerMode(Banner.Mode.OFF);
        springApplication.run(args);
        Date endDt = new Date();
        long startUpTime = endDt.getTime() - startDt.getTime();
        System.out.println("启动成功，耗时：" + startUpTime + "ms");
    }

    @Autowired
    private OpcUAClientRunner opcUAClientRunner;

    @Override
    public void run(String... args) {
        opcUAClientRunner.run();
    }
}
